home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group98a.txt / 000161_icon-group-sender _Wed Apr 15 07:58:43 1998.msg < prev    next >
Internet Message Format  |  2000-09-20  |  2KB

  1. Return-Path: <icon-group-sender>
  2. Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
  3.     by baskerville.CS.Arizona.EDU (8.8.8/8.8.7) with SMTP id HAA15011
  4.     for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Wed, 15 Apr 1998 07:58:42 -0700 (MST)
  5. Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
  6.     id AA25693; Wed, 15 Apr 1998 07:58:41 -0700
  7. From: DLucido <DLucido@aol.com>
  8. Message-Id: <78201599.35340ec3@aol.com>
  9. Date: Tue, 14 Apr 1998 21:34:57 EDT
  10. To: icon-group@optima.CS.Arizona.EDU
  11. Mime-Version: 1.0
  12. Subject: Tables of records
  13. Content-Type: text/plain; charset=US-ASCII
  14. Content-Transfer-Encoding: 7bit
  15. X-Mailer: AOL 3.0 16-bit for Windows sub 86
  16. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  17. Status: RO
  18. Content-Length: 787
  19.  
  20. I am brand new to Icon (Just got the book this week) and I have been
  21. experimenting
  22. with some code to test my understanding.  While the following is not in any 
  23. doucumentation I have found, it works.  I defined a record and created a table
  24. of
  25. records with  the following code:
  26.  
  27. record node(value,lchild,rchild)
  28.  
  29. procedure main(arg)
  30.  
  31.    tree:=table()
  32.    tree[1]:=node(2,3,"Hello")
  33.    tree[2]:=node(5,6,"World")
  34.    tree[3]:=node(0,1,"Oops")
  35.  
  36.    every i:=key(tree)do
  37.     write(i,":",tree[i].rchild)
  38.  
  39. end
  40.  
  41. While the order of the keys in unpredictable, the code can store a table of
  42. records.
  43. Is this a feature or something that should be avoided?
  44.  
  45.                                                          David Lucido
  46.                                                           dlucido@aol.com
  47.